home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Documentation / Tech Notes & Articles / Recipes / Scripting / 2-Semantic Events mods for SOM < prev    next >
Encoding:
Text File  |  1995-04-22  |  3.1 KB  |  57 lines  |  [TEXT/ttxt]

  1. OpenDoc™ Recipes
  2.  
  3.  
  4. Semantic Events under SOM
  5. By OpenDoc Design Team
  6.  
  7.  
  8. © 1993-1995  Apple Computer, Inc. All Rights Reserved.
  9. Apple, the Apple logo, and Macintosh are registered trademarks of Apple Computer, Inc.
  10. Mac and OpenDoc are trademarks of Apple Computer, Inc. 
  11.  
  12.  
  13. We’ve had to rearrange the Semantic Events interface for SOM. SOM does not support callback procedures which were used heavily by the public API. Instead the callback interface has been moved into a C++ helper class. You’ll have to do a little rearranging of your code to get back up and running.
  14.  
  15. SemanticInterface
  16.  
  17. This class has undergone extensive change for SOM. In fact, there’s nothing there which was there before! However, all the functionality is still around, but it’s now in a helper class. Here’s a class diagram.
  18.  
  19. ODBaseSemanticInterface     Specifies
  20.                                                                   interface;
  21.                                                                                                                                                                                                                                                                         no implementation
  22.  
  23. ODSemanticInterface    has a      SIHelperAbs          Specifies
  24. (C++ specific, for now).                                                                                                                                                                                                                                                interface;
  25. Delegates all methods                                                                                                                                                                                                                                                    no implementation
  26. to SIHelperAbs.
  27.                                                                                                                                                                                                                                                                                                     SIHelper                                                                        InstallEventHandler
  28.                                                                                                                                                                                                                                                                                                                                                                                                                                                                     InstallObjectAccessor
  29.  
  30.                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ‘
  31.                                                                                                                                                                                                                                                                                                                                                                                                                                                                 etc.
  32.  
  33. **Could not import figure from Word doc...
  34.  
  35. You need to use both SIHelper and ODSemanticInterface now instead of just XMPSemanticInterface. Here’s some example usage.
  36.  
  37. Initialization:
  38.  
  39.     ODSemanticInterface* face = new ODSemanticInterface();
  40.     SIHelper* help = new SIHelper();
  41.     help->InitSIHelper(face);
  42.     face->InitSemanticInterface(ev, somSelf, help);
  43.  
  44. Usage:
  45.  
  46.     ((SIHelper*)face->GetSIHelper(ev))->InstallEventHandler(…);
  47.  
  48. You, the client, are responsible for freeing both the SIHelper and the ODSemanticInterface object.
  49.  
  50. OpenDoc parts which wish to support the SemanticInterface extension are not required to use SIHelper, SIHelperAbs, or ODSemanticInterface. (ODSemanticInterface requires SIHelperAbs, however. If you use ODSemanticInterface, you must use SIHelperAbs. They are a pair.) They may choose to replace SIHelper with their own class. If they do this, they must subclass SIHelperAbs and provide implementations for its virtual methods. If they do not wish to use ODSemanticInterface, they may create their own subclass and implement all its methods. Most developers will want to use SIHelper since its API closely matches that of Apple events and the OSL.
  51.  
  52. SIHelper classes may be shared between multiple instances of ODSemanticInterfaces. However, ODBaseSemanticInterfaces (and their subclasses must occur only once per part. They cannot be shared.)
  53.  
  54. Recording
  55.  
  56. Parts must check to see if recording is on when they are initialized (if they care.) 
  57.